//
//  WorkHomeVC.m
//  XLDoctor
//
//  Created by longma on 2018/7/27.
//  Copyright © 2018年 XLH. All rights reserved.
//mj手机号码

#import "PhoneNumberVC.h"
#import "ChangPhoneNumberVC.h"

@interface PhoneNumberVC ()
@property (weak, nonatomic) IBOutlet UIButton *encryptButton;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (nonatomic, strong) NSString *phone;
@end

@implementation PhoneNumberVC


- (void)viewDidLoad {
    [super viewDidLoad];
   
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
}

- (void)mj_setUI{
    [super mj_setUI];
    
    self.mj_titleLocalizable = @"Phone Number";
    [self.encryptButton setTitle:[@" " stringByAppendingString:MJUILocalizedString(@"Show")] forState:0];
    [self.encryptButton setTitle:[@" " stringByAppendingString:MJUILocalizedString(@"Hide")] forState:UIControlStateSelected];
    
    [self.encryptButton setImage:MJUIImageMake(@"icon_zhengyan") forState:0];
    [self.encryptButton setImage:MJUIImageMake(@"icon_biyan") forState:UIControlStateSelected];
    [self.encryptButton setSelected:true];
    
    if(UserManager.shared.userModel.phoneNumber){
        [self handleButtonClick:self.encryptButton];
    }else{
        self.phoneLabel.hidden = true;
        self.encryptButton.hidden = true;
    }
    
}

#pragma mark - 方法
- (IBAction)handleButtonClick:(UIButton *)sender {
    [self.encryptButton setSelected:!self.encryptButton.isSelected];
    
    NSString *phoneNumber = UserManager.shared.userModel.phoneNumber;
    NSString *countryCode = UserManager.shared.userModel.countryCode;

    if(self.encryptButton.isSelected){
        self.phoneLabel.text = [NSString stringWithFormat:@"%@-%@",countryCode,phoneNumber];
    }else{
        self.phoneLabel.text = [NSString stringWithFormat:@"%@-%@",countryCode,phoneNumber.mj_securePhoneNumber];
    }
}

- (IBAction)handleChangeNumberButtonClick:(UIButton *)sender {
    ChangPhoneNumberVC *vc = [[ChangPhoneNumberVC alloc]init];
    [self.navigationController pushViewController:vc animated:true];
}

- (void)requestData{

}

#pragma mark - 代理

#pragma mark - 懒加载

@end
